Example: Say I have a script called viewsrc.bat. If I then add an HREF in a document to http://myserver/htbin/viewsrc.bat/dir1/dir2/source.c, /htbin/view-source will be called with the extra information as defined below. In this case, the extra information is /dir1/dir2/source.c.
A script such as viewsrc.bat is inherently dangerous, because it allows users to see your entire system. A proper script would translate the name into something else.
QUERY_STRING
In addition, it is passed on the command
line for yor script and can be accessed as %1%. If extra path information was
included with the URL,
it will be defined as the variable PATH_INFO
. In addition,
the path info will be translated from "virtual" to "physical" (a real
DOS path, using the DocumentRoot setting and aliases. This is defined
as the variable PATH_TRANSLATED
.Here are three examples that should help you visualize the process. Each of the following URL's calls a script that simply reports on what the script received in the way of arguments and environment variables. You must be reading this document via your server (not in local file mode) for the examples to work.
/cgi-bin/args.bat
No query string, no extra path information.
/cgi-bin/args.bat?Bob+Denny
Query string, no extra path info. This is what you would receive from an ISINDEX document, for example. The query can be hand-coded into a URL as well, if you obey the escaping rules.
/cgi-bin/args.bat/foo/bar/xyzzy.gif
No query string, extra path info. The stuff following the script name is the "virtual path" and appears in PATH_INFO. note what appears in the PATH_TRANSLATED environment variable!
/cgi-bin/args.bat/foo/bar/xyzzy.gif?256+color
Both query string and extra path info. The above example might be used to select a particular rendition of the xyzzy image, the 256 color version, as opposed to the 16 gray level one.